package com.ts.api.module.api.convert.receive.entity;

import com.gitee.apanlh.util.dataformat.JsonUtils;
import lombok.Data;

import java.util.Map;

/**
 *  API接收-解密返回实体
 *
 *  @author Pan
 */
@Data
public class ApiReceiveDecrypt {

    /** 解密过后的数据 */
    private String data;
    /** 存放拓展参数Map */
    private Map<String, String> extParam;

    public ApiReceiveDecrypt() {
        super();
    }

    public ApiReceiveDecrypt(Map<String, String> extParam) {
        this.extParam = extParam;
    }

    public ApiReceiveDecrypt(String data, Map<String, String> extParam) {
        this.data = data;
        this.extParam = extParam;
    }

    public ApiReceiveDecrypt(String data) {
        this.data = data;
    }

    /**
     *  解析
     *
     *  @param clazz
     *  @return
     *  @param <T>
     */
    public <T> T parse(Class<T> clazz) {
        return JsonUtils.toBean(this.data, clazz);
    }
}
